// license-header java merge-point
package edu.uoc.tfc.gui.parts.carregaTipusSinistre;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionMapping;

import edu.uoc.tfc.dto.TipusSinistreVO;
import edu.uoc.tfc.gui.common.Option;
import edu.uoc.tfc.gui.common.SelectBox;

/**
 * @see edu.uoc.tfc.gui.parts.carregaTipusSinistre.CarregaTipusSinistreController
 */
public class CarregaTipusSinistreControllerImpl extends CarregaTipusSinistreController
{
    /**
     * @see edu.uoc.tfc.gui.parts.carregaTipusSinistre.CarregaTipusSinistreController#carregaTipusSinistre(org.apache.struts.action.ActionMapping, edu.uoc.tfc.gui.parts.carregaTipusSinistre.CarregaTipusSinistreForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public final void carregaTipusSinistre(ActionMapping mapping, edu.uoc.tfc.gui.parts.carregaTipusSinistre.CarregaTipusSinistreForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {
    	SelectBox selectResultado = new SelectBox();

    	TipusSinistreVO[] tipus = this.getPartService()
    			.carregaTipusSinistre();

    	Option[] options = new Option[tipus.length];
    	for (int i=0; i<tipus.length; i++){
    		Option o = new Option();
    		TipusSinistreVO t = tipus[i];
    		
    		o.setOptionDisplay(t.getNom());
    		o.setOptionValue(t.getId().toString());
    		options[i]=o;
    	}
    	
    	selectResultado.setOptions(options);
    	form.setSelectResultat(selectResultado);	    
    }

}